// Copyright 叶湘 ( weixin:yexiang841, email:yexiang841@qq.com ), Shitouren Studio. All Rights Reserved.

#include "Property/Q3D_CPPU_PropertyState.h"
#include "Property/Q3D_CPPU_PropertyPLIPro.h"

void UQ3D_CPPU_PropertyState::Q3D_F_PropertyPLIPro_Construct(const FName &name_id, EQ3D_CPPE_PropertyName enum_property_name, int32 int_min, int32 int_max, EQ3D_CPPE_PropertyInit enum_property_init, int32 int_value, UQ3D_CPPU_PropertyPLIPro *&ptr_u_property_pli_pro, FString &string_log)
{
    if (!this->Ptr_A_Owner)
    {
        ptr_u_property_pli_pro = nullptr;
        string_log = "Invalid_Ptr_A_Owner";
        return;
    }
    FString string_log_tmp01 =
        StaticEnum<EQ3D_CPPE_PropertyName>()->GetNameStringByValue((uint8)(enum_property_name)) + "(" + FString::FromInt(int_min) + "," + FString::FromInt(int_max) + "," + StaticEnum<EQ3D_CPPE_PropertyInit>()->GetNameStringByValue((uint8)(enum_property_init)) + "," + FString::FromInt(int_value) + ")";
    UQ3D_CPPU_PropertyPLIPro *ptr_u_property_pli_pro_tmp = CreateDefaultSubobject<UQ3D_CPPU_PropertyPLIPro>(name_id);
    ptr_u_property_pli_pro_tmp->Enum_PropertyName = enum_property_name;
    bool bool_success;
    FString string_log_tmp02;
    ptr_u_property_pli_pro_tmp->Q3D_F_Limit_Set(int_min, int_max, bool_success, string_log_tmp02);
    if (!bool_success)
    {
        ptr_u_property_pli_pro = nullptr;
        string_log = "Limit_Set_From_" + string_log_tmp01 + "_Failed " + string_log_tmp02;
        return;
    }
    switch (enum_property_init)
    {
    case EQ3D_CPPE_PropertyInit::Init_Min:
        ptr_u_property_pli_pro_tmp->Q3D_F_Value_Set(ptr_u_property_pli_pro_tmp->Int_Min);
        break;

    case EQ3D_CPPE_PropertyInit::Init_Max:
        ptr_u_property_pli_pro_tmp->Q3D_F_Value_Set(ptr_u_property_pli_pro_tmp->Int_Max);
        break;

    case EQ3D_CPPE_PropertyInit::Init_Random:
        ptr_u_property_pli_pro_tmp->Q3D_F_Value_SetRandom();
        break;

    case EQ3D_CPPE_PropertyInit::Init_Int:
        ptr_u_property_pli_pro_tmp->Q3D_F_Value_Set(int_value);
        break;

    default:
        break;
    }
    this->Map_PropertyName_To_Ptr_U_PropertyPLIPro.Add(enum_property_name, ptr_u_property_pli_pro_tmp);
    ptr_u_property_pli_pro = ptr_u_property_pli_pro_tmp;
    string_log = "Create_" + ptr_u_property_pli_pro_tmp->Q3D_F_ToString_Pro() + "_From_" + string_log_tmp01;
    return;
}

void UQ3D_CPPU_PropertyState::Q3D_F_PropertyPLIPro_Create(EQ3D_CPPE_PropertyName enum_property_name, int32 int_min, int32 int_max, EQ3D_CPPE_PropertyInit enum_property_init, int32 int_value, UQ3D_CPPU_PropertyPLIPro *&ptr_u_property_pli_pro, FString &string_log)
{
    if (!this->Ptr_A_Owner)
    {
        ptr_u_property_pli_pro = nullptr;
        string_log = "Invalid_Ptr_A_Owner";
        return;
    }
    FString string_log_tmp01 =
        StaticEnum<EQ3D_CPPE_PropertyName>()->GetNameStringByValue((uint8)(enum_property_name)) + "(" + FString::FromInt(int_min) + "," + FString::FromInt(int_max) + "," + StaticEnum<EQ3D_CPPE_PropertyInit>()->GetNameStringByValue((uint8)(enum_property_init)) + "," + FString::FromInt(int_value) + ")";
    UQ3D_CPPU_PropertyPLIPro *ptr_u_property_pli_pro_tmp = NewObject<UQ3D_CPPU_PropertyPLIPro>(this->Ptr_A_Owner);
    ptr_u_property_pli_pro_tmp->Enum_PropertyName = enum_property_name;
    bool bool_success;
    FString string_log_tmp02;
    ptr_u_property_pli_pro_tmp->Q3D_F_Limit_Set(int_min, int_max, bool_success, string_log_tmp02);
    if (!bool_success)
    {
        ptr_u_property_pli_pro = nullptr;
        string_log = "Limit_Set_From_" + string_log_tmp01 + "_Failed " + string_log_tmp02;
        return;
    }
    switch (enum_property_init)
    {
    case EQ3D_CPPE_PropertyInit::Init_Min:
        ptr_u_property_pli_pro_tmp->Q3D_F_Value_Set(ptr_u_property_pli_pro_tmp->Int_Min);
        break;

    case EQ3D_CPPE_PropertyInit::Init_Max:
        ptr_u_property_pli_pro_tmp->Q3D_F_Value_Set(ptr_u_property_pli_pro_tmp->Int_Max);
        break;

    case EQ3D_CPPE_PropertyInit::Init_Random:
        ptr_u_property_pli_pro_tmp->Q3D_F_Value_SetRandom();
        break;

    case EQ3D_CPPE_PropertyInit::Init_Int:
        ptr_u_property_pli_pro_tmp->Q3D_F_Value_Set(int_value);
        break;

    default:
        break;
    }
    this->Map_PropertyName_To_Ptr_U_PropertyPLIPro.Add(enum_property_name, ptr_u_property_pli_pro_tmp);
    ptr_u_property_pli_pro = ptr_u_property_pli_pro_tmp;
    string_log = "Create_" + ptr_u_property_pli_pro_tmp->Q3D_F_ToString_Pro() + "_From_" + string_log_tmp01;
    return;
}

void UQ3D_CPPU_PropertyState::Q3D_F_PropertyPLIPro_Get(EQ3D_CPPE_PropertyName enum_property_name, UQ3D_CPPU_PropertyPLIPro *&ptr_u_property_pli_pro, FString &string_log)
{
    UQ3D_CPPU_PropertyPLIPro **ptr_ptr_u_property_pli_pro = this->Map_PropertyName_To_Ptr_U_PropertyPLIPro.Find(enum_property_name);
    if (!ptr_ptr_u_property_pli_pro)
    {
        ptr_u_property_pli_pro = nullptr;
        string_log = "Property_[" + StaticEnum<EQ3D_CPPE_PropertyName>()->GetNameStringByValue((uint8)(enum_property_name)) + "]_Missed";
        return;
    }
    ptr_u_property_pli_pro = *ptr_ptr_u_property_pli_pro;
    string_log = "Get_" + ptr_u_property_pli_pro->Q3D_F_ToString_Pro();
    return;
}

void UQ3D_CPPU_PropertyState::Q3D_F_PropertyPLIPro_GetValue(EQ3D_CPPE_PropertyName enum_property_name, UQ3D_CPPU_PropertyPLIPro *&ptr_u_property_pli_pro, int32 &int_min, int32 &int_max, int32 &int_value, int32 &int_value_pro, float &float_percent, int32 &int_percent, FString &string_log)
{
    UQ3D_CPPU_PropertyPLIPro **ptr_ptr_u_property_pli_pro = this->Map_PropertyName_To_Ptr_U_PropertyPLIPro.Find(enum_property_name);
    if (!ptr_ptr_u_property_pli_pro)
    {
        ptr_u_property_pli_pro = nullptr;
        int_min = 0;
        int_max = 0;
        int_value = 0;
        int_value_pro = 0;
        float_percent = 0.f;
        int_percent = 0;
        string_log = "Property_[" + StaticEnum<EQ3D_CPPE_PropertyName>()->GetNameStringByValue((uint8)(enum_property_name)) + "]_Missed";
        return;
    }
    ptr_u_property_pli_pro = *ptr_ptr_u_property_pli_pro;
    int_min = ptr_u_property_pli_pro->Int_Min;
    int_max = ptr_u_property_pli_pro->Int_Max;
    int_value = ptr_u_property_pli_pro->Int_Value;
    int_value_pro = ptr_u_property_pli_pro->Int_ValuePro;
    float_percent = ptr_u_property_pli_pro->Float_Percent;
    int_percent = ptr_u_property_pli_pro->Int_Percent;
    string_log = "GetValue_" + ptr_u_property_pli_pro->Q3D_F_ToString_Pro();
    return;
}
